<!DOCTYPE html>

<html xmlns:th="http://www.w3.org/1999/xhtml" lang="">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>晟融支付运营平台登录</title>
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
    <link rel="bookmark" href="favicon.ico"/>
    <link rel="stylesheet" href="plugins/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="css/login.css"/>
</head>

<body class="beg-login-bg">
<div class="beg-login-box">
    <header>
        <h1>晟融支付运营平台</h1>
    </header>
    <div class="beg-login-main">
        <form action="" class="layui-form" method="post">
            <div class="layui-form-item">
                <label style="color:red" th:if="${param:error}" th:text="账号或密码错误，请重新输入" id="lable"></label>
            </div>
            <div class="layui-form-item">
                <label class="beg-login-icon">
                    <i class="layui-icon">&#xe612;</i>
                </label>
                <input type="text" name="username" lay-verify="username" autocomplete="off" placeholder="这里输入登录名"
                       class="layui-input" value="">
            </div>
            <div class="layui-form-item">
                <label class="beg-login-icon">
                    <i class="layui-icon">&#xe642;</i>
                </label>
                <input type="password" name="password" lay-verify="password" autocomplete="off" placeholder="这里输入密码"
                       class="layui-input" value="">
            </div>
            <div class="layui-form-item">
                <div class="beg-pull-left beg-login-remember">
                    <label>记住帐号？</label>
                    <input type="checkbox" name="rememberMe" value="true" lay-skin="switch" checked title="记住帐号">
                </div>
                <div class="beg-pull-right">
                    <button class="layui-btn layui-btn-primary" lay-submit lay-filter="login">
                        <i class="layui-icon">&#xe650;</i> 登录
                    </button>
                </div>
                <div class="beg-clear"></div>
            </div>
        </form>
    </div>
    <footer>
        <p>Sunreal © www.sunreal.cn</p>
    </footer>
</div>
<script type="text/javascript" src="plugins/layui/layui.js"></script>
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="datas/nav.js"></script>
<script src="js/index.js"></script>
<script>
    layui.use(['layer', 'form'], function () {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form();

        form.on('submit(login)', function (data) {
            $.ajax({
                type: "POST",
                url: "/login",
                contentType : "application/json",
                data: JSON.stringify(data.field),
                success: function (msg) {
                    console.log(msg);
                    return false;
                    if (msg && msg.indexOf("html") > 0) {
                        location.href = msg;
                    } else {
                        layerTips.msg(msg);
                        return false;
                    }
                },
                error: function (msg) {
                    console.log(msg);
                    return false;
                }
            });

        });
    });
</script>
</body>

</html>
